package com.wjd.wshow.common.resource.pojo;

import com.wjd.wshow.common.resource.AbstractResource;
import com.wjd.wshow.common.resource.ResourceType;
import com.wjd.wshow.common.resource.loader.ResourceLoader;

import java.nio.file.Path;

public class ThumbnailResource extends AbstractResource {

    private static String defaultType = "png";

    private String resId;
    private String thumbType;

    public ThumbnailResource(String resId) {
        this(resId, defaultType);
    }

    public ThumbnailResource(String resId, String thumbType) {
        this.resId = resId;
        this.thumbType = thumbType;
    }

    @Override
    public String getResId() {
        return this.resId;
    }

    @Override
    public ResourceType getType() {
        return ResourceType.THUMBNAIL;
    }

    @Override
    public Path getPath() {
        ResourceType resourceType = getType();
        Path resourcePath = ResourceLoader.getLoader().getResourcePath(resourceType);
        String resourceName = getResId() + "." + this.thumbType;
        resourcePath = resourcePath.resolve(resourceName);
        return resourcePath;
    }

}
